<style>
    table {
        width: 100%;
    }
    th {
        background-color: #f5f5f5;
        text-align: center;
        padding-top: 5px;
        padding-bottom: 5px;
        font-weight: bold;
        font-size: 16px;
    }
    td:first-child {
        font-size: 15px;
        text-align: right;
        padding-right: 5px;
        width: 40%;
    }
    textarea {
        width: 600px;
    }
</style>
<div class="mt20"  style="margin-left: auto;margin-right: auto;width: 1240px;">
    <table>
        <thead>
        <th colspan="2"><b><?php echo $this->translate('订单编号'); ?>：</b><?php echo $this->orderinfo->order_sn; ?></th>
        </thead>
        <tr>
            <td><b><?php echo $this->translate('微信扫码支付'); ?>：</b></td>
            <td>
                <input type="hidden" name="order_sn" id="order_sn" value="<?php echo $this->orderinfo->order_sn; ?>">
                <img alt="<?php echo $this->translate('微信二维码扫码支付'); ?>" src="<?php echo $this->qrcode_url; ?>" style="width:260px;height:260px;"/></td>
        </tr>
    </table>
</div>
<script>
    $(document).ready(function () {
        setInterval("ajaxOrderStatus()", 3000);
    });
    function ajaxOrderStatus() {
        if ($("#order_sn").val() != '') {
            $.ajax({
                url: "<?php echo $this->url('frontorder/default', array('action'=>'ajaxOrderStatus')); ?>?order_sn=" + $("#order_sn").val(),
                type: "GET",
                dataType:"json",
                data: "",
                success: function (data) {
                    if (data.state=='true') {
                        alert('<?php echo $this->translate('订单支付成功！'); ?>');
                        window.location.href = "<?php echo $this->url('frontorder/default/order_state', array('action'=>'index', 'order_state'=>20)); ?>"; //页面跳转
                    }
                    if(data.state == 'false') {
                        alert('<?php echo $this->translate('订单支付失败！'); ?>');
                        window.location.href = "<?php echo $this->url('frontorder/default'); ?>"; //页面跳转
                    }
                }
            });
        }
    }
</script>